$(function() {
	$("#loading-first").fadeOut(500);
//报废
$('.audit_ok').on('click',function(){
	Msg('车辆确认')
	setTimeout(function(){
	window.history.back();
	},1000)
})
$('.audit_no').on('click',function(){
	window.history.back();
})
$('.blank_close').on('click',function(){
	window.close()
})
$('.scrapok').on('click',function(){
	Msg('同意报废')
	window.location.href="{:url('scrap')}"
})
$('.scrapno').on('click',function(){
	Msg('拒绝报废')
	window.location.href="{:url('scrap')}"
})
$('.edit').on('click',function(){
	window.location.href='{:url("edit")}?car_id='+"{$Think.get.car_id}"
})
console.log($('.unit_main_w').height())
//报废结束
	var search = window.location.search
	var arr;
	if(search) {
		search = search.substring(1)
		arr = search.split('=')
		if(arr[0] == 'service') {
			$('.am-nav-tabs li').removeClass('am-active')
			$('.am-nav-tabs li').eq(1).addClass('am-active')
			$('.am-tabs-bd-ofv>div').removeClass('am-active')
			$('.am-tabs-bd-ofv>div').eq(1).addClass('am-active')
		} else if(arr[0] == 'refuel') {
			$('.am-nav-tabs li').removeClass('am-active')
			$('.am-nav-tabs li').eq(2).addClass('am-active')
			$('.am-tabs-bd-ofv>div').removeClass('am-active')
			$('.am-tabs-bd-ofv>div').eq(2).addClass('am-active')
		} else if(arr[0] == 'insure') {
			$('.am-nav-tabs li').removeClass('am-active')
			$('.am-nav-tabs li').eq(3).addClass('am-active')
			$('.am-tabs-bd-ofv>div').removeClass('am-active')
			$('.am-tabs-bd-ofv>div').eq(3).addClass('am-active')
		} else if(arr[0] == 'survey') {
			$('.am-nav-tabs li').removeClass('am-active')
			$('.am-nav-tabs li').eq(4).addClass('am-active')
			$('.am-tabs-bd-ofv>div').removeClass('am-active')
			$('.am-tabs-bd-ofv>div').eq(4).addClass('am-active')
		}
	}
	$('.back').on('click', function() {
		window.history.back();
	});
	
	
	$.ajax({
			type: "post",
			url: "{:url('admin/beidou/cars')}",
			data: {
				pagesize: 10,
				number:"{$item.number}"
			},
			success: function(res) {
				console.log(res.data)
				if(res.data.length!=0){
					AMap.plugin('AMap.Geocoder', function() {
						geocoder = new AMap.Geocoder({
							city: "010" //城市，默认：“全国”
						});
						geocoder.getAddress(res.data[0].loc, function(status, result) {
							if(status === 'complete' && result.info === 'OK') {
								//获得了有效的地址信息:
								//即，
								if(result.regeocode.formattedAddress==""){
									$('.loc').html('无定位信息')
								}else{
									$('.loc').html(result.regeocode.formattedAddress)
								}
								console.log(result.regeocode.formattedAddress)
							} else {
								$('.loc').html('无定位信息')
								
							}
						});
						$(that).on('mouseout', function() {
							layer.close(tips)
						})
					})
					
				}else{
					$('.loc').html('无定位信息')
				}
			}
	})
	
})